Skip to main content

Node.js deployment

Project Extraction

  • First you have to extract the snapta.zip then you will get three zip files.

    • snapta_laravel.zip
    • snapta_admin.zip
    • snapta_node.zip
    • snapta_web.zip (if you have website version)
    • snapta_app.zip (if you have application version)
  • Upload snapta_node.zip to a location where you want to deploy Project using FileZilla

    • /var/www/snapta_node (This is the recommended location)
  • Install unzip to unzip the Project . Run following command to install unzip

sudo apt install unzip

Server Starting

  • Open Terminal on the location where package.json is located.
  • Run following command to install dependencies
npm install
  • To install PM2 Globally
npm install -g pm2
  • To run server run following command within the terminal where package.json is located.
pm2 start index.js

Auto restart on server reboot

  • Run following command to save all the process running on pm2
pm2 save
  • Run following command to restart all the saved processes on server restart
pm2 startup systemd
  • Run following command to see running pm2 processes
pm2 status
  • Run following command to see logs of a process
pm2  log {index}